It is a concept taken from the Old Testament, where spirits of the dead consulted by fortune tellers to know the future are mentioned. Although doing so is an apostasy punishable by death.